package collage.SUBJECT;

import java.util.Scanner;

import javax.net.ssl.SSLContext;





public class SUBJECT_Service implements ISUBJECT_Service{

	SUBJECT_DAO sdao = new SUBJECT_DAO();
	
	
	@Override
	public void createSubject() {
		System.out.println( "과목정보 등록");
		
		Scanner sc = new Scanner(System.in);
		SUBJECT_VO s = new SUBJECT_VO();
		
		System.out.println( "과목번호를 입력해 주세요");
		s.setSub_no( sc.next() );
		System.out.println( "과목명을 입력해 주세요" );
		s.setSub_name( sc.next() );
		System.out.println( "과목유형번호를 입력해 주세요" );
		s.setSub_type_no( sc.next() );
		System.out.println( "과목 개요를 입력해주세요" );
		s.setSub_info( sc.next() );
		System.out.println( "배정학점을 입력해주세요" );
		s.setSub_point( sc.next() );
		System.out.println( "담당교수를 입력해주세요 ");
		s.setProf_no( sc.next() );
		
		if( sdao.insertSubject(s) ){
			System.out.println("정삭적으로 입력되었습니다.");
		}
		else{
			System.out.println( "눈 똑바로 안뜰래?" );
		}
		
		
	}

	@Override
	public void readSubject() {
		for ( SUBJECT_VO s : sdao.selectSubject() ){
			System.out.print( s.getSub_tr() );
			System.out.print( " / ");
			System.out.print( s.getSub_no() );
			System.out.print( " / ");
			System.out.print( s.getSub_name() );
			System.out.print( " / ");
			System.out.print( s.getSub_info() );
			System.out.print( " / ");
			System.out.print( s.getSub_point() );
			System.out.print( " / ");
			System.out.print( s.getSub_type_no() );
			System.out.print( " / ");
			System.out.print( s.getProf_no() );
			System.out.print( " / ");
			System.out.println( s.getRegdate() );
			
			
			
			
			
		}
		
	}

	@Override
	public void modifySubject() {
	
		System.out.println( "과목정보 수정");
		
		Scanner sc = new Scanner(System.in);
		SUBJECT_VO s = new SUBJECT_VO();
		
		System.out.println( "수정할 과목번호를 입력해 주세요");
		s.setSub_no( sc.next() );
		System.out.println( "과목명을 입력해 주세요" );
		s.setSub_name( sc.next() );
		System.out.println( "과목유형번호를 입력해 주세요" );
		s.setSub_type_no( sc.next() );
		System.out.println( "과목 개요를 입력해주세요" );
		s.setSub_info( sc.next() );
		System.out.println( "배정학점을 입력해주세요" );
		s.setSub_point( sc.next() );
		System.out.println( "담당교수를 입력해주세요 ");
		s.setProf_no( sc.next() );
		
		if( sdao.updateSubject(s) ){
			System.out.println("정삭적으로 입력되었습니다.");
		}
		else{
			System.out.println( "눈 똑바로 안뜰래?" );
		}
		
	}

	@Override
	public void removeSubject() {
		Scanner sc = new Scanner(System.in);
		SUBJECT_VO s = new SUBJECT_VO();
		
		System.out.println( "삭제할 과목번호를 입력해 주세요");
		s.setSub_no( sc.next() );
		
		if( sdao.deleteSubject(s) ){
			System.out.println("정삭적으로 삭제되었습니다.");
		}
		else{
			System.out.println( "눈 똑바로 안뜰래?" );
		}
		
	}

	@Override
	public void startSubject() {
	
				
		
	}
	

	@Override
	public void caseLibrary() {
		// TODO Auto-generated method stub
		
	}

} // class
